﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Comdiv.QWeb.Events;
using NUnit.Framework;

namespace Comdiv.QWeb.Test.Events
{
	[TestFixture]
	public class reset_event_test
	{
		[Test]
		public void reset_data_is_well_with_all_option() {
			var d = (ResetEventData)new ResetEventData().Build(new QWebContext().Set("all", true));
			Assert.IsTrue(d.IsSet("test"));
			Assert.IsTrue(d.IsSet("test.1"));
		}

		[Test]
		public void reset_data_is_well_no_all_option()
		{
			var d = (ResetEventData)new ResetEventData().Build(new QWebContext().Set("all", false));
			Assert.IsFalse(d.IsSet("test"));
			Assert.IsFalse(d.IsSet("test.1"));
		}

		[Test]
		public void reset_data_is_well_no_all_option_exact()
		{
			var d = (ResetEventData)new ResetEventData().Build(new QWebContext().Set("rp.test.1", true));
			Assert.IsTrue(d.IsSet("test"));
			Assert.IsTrue(d.IsSet("test.1"));
			Assert.IsFalse(d.IsSet("test.2"));
		}
		[Test]
		public void reset_data_is_well_no_all_option_domain()
		{
			var d = (ResetEventData)new ResetEventData().Build(new QWebContext().Set("rp.test", true));
			Assert.IsTrue(d.IsSet("test"));
			Assert.IsTrue(d.IsSet("test.1"));
			Assert.IsTrue(d.IsSet("test.2"));
		}
	}
}
